home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / doc / indent.doc < prev    next >
Text File  |  1990-07-19  |  14KB  |  415 lines

  1.   10      14325: 14 Sep 89 Robert R. Hall  indent.doc
  2. (Message # 10: 14325 bytes)
  3. Received: from star.cs.vu.nl by top.cs.vu.nl id aa06624; 14 Sep 89 18:32 MET DST
  4. Received: from hp4nl.nluug.nl by star.cs.vu.nl id aa17761;
  5.           14 Sep 89 18:32 MET DST
  6. Received: from [128.49.16.5] by hp4nl.nluug.nl with SMTP
  7.           id AA14859 (5.58.1.14/2.14); Thu, 14 Sep 89 18:21:05 MET
  8. Received: by cod.nosc.mil (5.59/1.27)
  9.     id AA09086; Thu, 14 Sep 89 09:19:44 PDT
  10. Date: Thu, 14 Sep 89 09:19:44 PDT
  11. From: "Robert R. Hall" <hall@cod.nosc.mil>
  12. Message-Id: <8909141619.AA09086@cod.nosc.mil>
  13. To: ast@cs.vu.nl
  14. Subject: indent.doc
  15.  
  16. -------
  17.  
  18.  
  19.  
  20. INDENT(1)           UNIX Programmer's Manual            INDENT(1)
  21.  
  22.  
  23.  
  24. NAME
  25.      indent - indent and format C program source
  26.  
  27. SYNOPSIS
  28.      indent  [ _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e [ _✓o_✓u_✓t_✓p_✓u_✓t-_✓f_✓i_✓l_✓e ] ] [ -bad | -nbad ]
  29.             [ -bap | -nbap ] [ -bbb | -nbbb ] [ -bc | -nbc ]
  30.             [ -bl | -br ] [ -c_✓n ] [ -cd_✓n ] [ -cdb | -ncdb ]
  31.             [ -ce | -nce ] [ -ci_✓n ] [ -cli_✓n ] [ -d_✓n ] [ -di_✓n ]
  32.             [ -dj | -ndj ] [ -ei | -nei ] [ -fc1 | -nfc1 ]
  33.             [ -i_✓n ] [ -ip | -nip ] [ -l_✓n ] [ -lc_✓n ]
  34.             [ -lp | -nlp ] [ -npro ] [ -pcs | -npcs ]
  35.             [ -ps | -nps ] [ -psl | -npsl ] [ -sc | -nsc ]
  36.             [ -sob | -nsob ] [ -st ] [ -troff ] [ -v | -nv ]
  37.  
  38. DESCRIPTION
  39.      _✓I_✓n_✓d_✓e_✓n_✓t is a C program formatter.  It reformats the C program
  40.      in the _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e according to the switches.  The switches
  41.      which can be specified are described below. They may appear
  42.      before or after the file names.
  43.  
  44.      NOTE: If you only specify an _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e, the formatting is
  45.      done `in-place', that is, the formatted file is written back
  46.      into _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e and a backup copy of _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is written
  47.      in the current directory.  If _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is named
  48.      `/blah/blah/file', the backup file is named file._✓B_✓A_✓K.
  49.  
  50.      If _✓o_✓u_✓t_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is specified, _✓i_✓n_✓d_✓e_✓n_✓t checks to make sure it
  51.      is different from _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e.
  52.  
  53. OPTIONS
  54.      The options listed below control the formatting style
  55.      imposed by _✓i_✓n_✓d_✓e_✓n_✓t.
  56.  
  57.      -bad,-nbad     If -bad is specified, a blank line is forced
  58.                     after every block of declarations.  Default:
  59.                     -nbad.
  60.  
  61.      -bap,-nbap     If -bap is specified, a blank line is forced
  62.                     after every procedure body.  Default: -nbap.
  63.  
  64.      -bbb,-nbbb     If -bbb is specified, a blank line is forced
  65.                     before every block comment.  Default: -nbbb.
  66.  
  67.      -bc,-nbc       If -bc is specified, then a newline is forced
  68.                     after each comma in a declaration. -nbc turns
  69.                     off this option.  The default is -nbc.
  70.  
  71.      -br,-bl        Specifying -bl lines up compound statements
  72.                     like this:
  73.                         if (...)
  74.                         {
  75.                             code
  76.  
  77.  
  78.  
  79. Printed 11/1/86        September 10, 1985                       1
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86. INDENT(1)           UNIX Programmer's Manual            INDENT(1)
  87.  
  88.  
  89.  
  90.                         }
  91.                     Specifying -br (the default) makes them look
  92.                     like this:
  93.                         if (...) {
  94.                             code
  95.                         }
  96.  
  97.      -c_✓n            The column in which comments on code start.
  98.                     The default is 33.
  99.  
  100.      -cd_✓n           The column in which comments on declarations
  101.                     start.  The default is for these comments to
  102.                     start in the same column as those on code.
  103.  
  104.      -cdb,-ncdb     Enables (disables) the placement of comment
  105.                     delimiters on blank lines.  With this option
  106.                     enabled, comments look like this:
  107.                          /*
  108.                           * this is a comment
  109.                           */
  110.                     Rather than like this:
  111.                          /* this is a comment */
  112.                     This only affects block comments, not com-
  113.                     ments to the right of code. The default is
  114.                     -cdb.
  115.  
  116.      -ce,-nce       Enables (disables) forcing `else's to cuddle
  117.                     up to the immediately preceding `}'.  The
  118.                     default is -ce.
  119.  
  120.      -ci_✓n           Sets the continuation indent to be _✓n.  Con-
  121.                     tinuation lines will be indented that far
  122.                     from the beginning of the first line of the
  123.                     statement.  Parenthesized expressions have
  124.                     extra indentation added to indicate the nest-
  125.                     ing, unless -lp is in effect.  -ci defaults
  126.                     to the same value as -i.
  127.  
  128.      -cli_✓n          Causes case labels to be indented _✓n tab stops
  129.                     to the right of the containing switch state-
  130.                     ment.  -cli0.5 causes case labels to be
  131.                     indented half a tab stop.  The default is
  132.                     -cli0.  (This is the only option that takes a
  133.                     fractional argument.)
  134.  
  135.      -d_✓n            Controls the placement of comments which are
  136.                     not to the right of code.  Specifying -d1
  137.                     means that such comments are placed one
  138.                     indentation level to the left of code.  The
  139.                     default -d0 lines up these comments with the
  140.                     code.  See the section on comment indentation
  141.                     below.
  142.  
  143.  
  144.  
  145. Printed 11/1/86        September 10, 1985                       2
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. INDENT(1)           UNIX Programmer's Manual            INDENT(1)
  153.  
  154.  
  155.  
  156.      -di_✓n           Specifies the indentation, in character posi-
  157.                     tions, from a declaration keyword to the fol-
  158.                     lowing identifier.  The default is -di16.
  159.  
  160.      -dj,-ndj       -dj left justifies declarations.  -ndj
  161.                     indents declarations the same as code.  The
  162.                     default is -ndj.
  163.  
  164.      -ei,-nei       Enables (disables) special else-if process-
  165.                     ing.  If enabled, ifs following elses will
  166.                     have the same indentation as the preceding if
  167.                     statement.  The default is -ei.
  168.  
  169.      -fc1,-nfc1     Enables (disables) the formatting of comments
  170.                     that start in column 1.  Often, comments
  171.                     whose leading `/' is in column 1 have been
  172.                     carefully hand formatted by the programmer.
  173.                     In such cases, -nfc1 should be used.  The
  174.                     default is -fc1.
  175.  
  176.      -i_✓n            The number of spaces for one indentation
  177.                     level.  The default is 8.
  178.  
  179.      -ip,-nip       Enables (disables) the indentation of parame-
  180.                     ter declarations from the left margin.  The
  181.                     default is -ip.
  182.  
  183.      -l_✓n            Maximum length of an output line.  The
  184.                     default is 78.
  185.  
  186.      -lp,-nlp       Lines up code surrounded by parenthesis in
  187.                     continuation lines.  If a line has a left
  188.                     paren which is not closed on that line, then
  189.                     continuation lines will be lined up to start
  190.                     at the character position just after the left
  191.                     paren.  For example, here is how a piece of
  192.                     continued code looks with -nlp in effect:
  193.                         p1 = first_procedure(second_procedure(p2, p3),
  194.                             third_procedure(p4, p5));
  195.                     With -lp in effect (the default) the code
  196.                     looks somewhat clearer:
  197.                         p1 = first_procedure(second_procedure(p2, p3),
  198.                                              third_procedure(p4, p5));
  199.                     Inserting two more newlines we get:
  200.                         p1 = first_procedure(second_procedure(p2,
  201.                                                               p3),
  202.                                              third_procedure(p4,
  203.